package com.example.widget.view

import android.os.Bundle
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ContextAmbient
import androidx.compose.ui.platform.setContent
import androidx.compose.ui.unit.dp
import com.example.base.BaseActivity
import com.example.base.commonView.CommonThemeNew
import com.example.base.commonView.TitleBar

class CustomViewActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            showView()
        }
    }

    @Composable
    fun showView() {
        val context = ContextAmbient.current as CustomViewActivity
        CommonThemeNew {
            TitleBar(title = "CustomView") {
                context.finish()
            }

            Canvas(modifier = Modifier.fillMaxSize()) {
                drawCircle(color = Color.Green, radius = 300f)
                drawCircle(color = Color.Yellow, radius = 200f)
                drawCircle(color = Color.Red, radius = 100f)
            }
        }
    }
}